import React, {Component} from 'react'
class WrappedComponent extends Component {
  constructor (props) {
    super(props)
  }
  render () {
    const {user, name, age} = this.props
    return (
      <div>
        <p>user: {user}</p>
        <p>name: {name}</p>
        <p>age: {age}</p>
      </div>
    )
  }
}

function removeUserProp (WrappedComponent) {
  return class WrappingComponent extends Component {
    render () {
      const {user, ...otherProps} = this.props 
      return <WrappedComponent {...otherProps} />
    }
  }
}
export default removeUserProp(WrappedComponent)